package com.hellowx.feignclient;


import com.hellowx.entity.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @author MagicMushroom
 * @date 2021/7/4
 */
@FeignClient(value = "PRODUCT",path = "/product")
public interface ProductClient {
    @GetMapping()
    String product();

    @GetMapping("/testQueryString")
    String testQueryString(@RequestParam("id") Integer id,@RequestParam("name")String name);

    @GetMapping("/testRestFull/{id}/{name}")
    String testRestFull(@PathVariable("id")Integer id,@PathVariable("name")String name);

    @PostMapping("/testJson")
    String testJson(@RequestBody Product product);

    @GetMapping("/testArray")
    String testArray(@RequestParam("ids")Integer[] ids);

    @GetMapping("/testList")
    String testList(@RequestParam("ids")Integer[] ids);

    @GetMapping("/testObject")
    String testObject(@RequestParam("id") Integer id,
                      @RequestParam("name") String name,
                      @RequestParam("categoryId")Integer categoryId);

    @GetMapping("/{id}")
    Product testReturnObject(@PathVariable("id")Integer id);

    @GetMapping("/find/{categoryId}")
    List<Product> testReturnList(@PathVariable("categoryId")Integer category);

    @GetMapping("/findAll")
    String testReturnMap(@RequestParam("pageIndex")Integer pageIndex,@RequestParam("pageSize")Integer pageSize);

}
